import axios from 'axios'
// 36049df44512b6a01ba7610461bf5714fb0fc337f08aa3422f31a1c36ffbab641e8907c67206e1edd78b6050a17a35e705925a4e6992f61d07c385928f88e8de
// https://www.cnblogs.com/yeqrblog/p/9850811.html
const requestApi = (_type, _url, _params) => {
    let config = 'http://localhost:8080';
     //这里我需要把传过了_type,_url,_params处理成我真正发给axios需要的内容,这里我定义一个变量为_config，它就是axios里面的内容
     let _config={url:config+_url,method:_type,data:_params};
     // let _config={url:config+_url+'?fid=0&key=d1a98b63bb55f766576af9f3a96cbd25',_type}
     console.log(_config);
     axios.defaults.withCredentials = true;
     return new Promise((resolve,reject)=>{

         axios(_config).then(res=>{
             // console.log(res);
             resolve(res)
         }).catch(err => {
             // console.log(err);
             reject(err)
         })

     })

}

export default requestApi;